<script setup>
import { ref, onMounted } from 'vue';
import { RouterLink } from 'vue-router';

let students = ref([]);
onMounted(() => {
    // 模拟一下数据获取
    students.value = [
        { id: 1, name: '小张', age: 22 },
        { id: 2, name: '小李', age: 33 },
        { id: 3, name: '小王', age: 44 }
    ]
})

</script>

<template>
    <h3>List View</h3>
    <ul>
        <li v-for="student in students" :key="student.id">
            {{ student.id }}.{{ student.name }}-{{ student.age }}&nbsp;
            <!-- <RouterLink :to="{ path: `/User/${student.id}` }">编辑</RouterLink> -->
            <RouterLink :to="`/User/${student.id}`">编辑</RouterLink>
        </li>
    </ul>
</template>

<style scoped></style>